package com.wudl.sparksql

import org.apache.spark.sql.{Dataset, SparkSession}

object CreateDs {
  def main(args: Array[String]): Unit = {

    val spark:SparkSession = SparkSession.builder().appName("CreateDs").master("local[1]").getOrCreate()
    import  spark.implicits._
//    val list:List[Int] = List(1,3,5,7,8,9)
//    val ds:Dataset[Int] = list.toDS()

    //  ds 转df

    val list:List[User] = List(User("zs",20),User("ws",80),User("ps",70))
    val ds:Dataset[User] = list.toDS()
    ds.createOrReplaceTempView("user")
    spark.sql("select * from user where age > 70").show()




    ds.show()
    spark.stop()


  }

}
